Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 관리자가 인터뷰 질문 생성 정책, 패치 노트 및 일반 사이트 설정을 관리할 수 있는 새로운 기능을 도입하여 플랫폼의 관리 기능을 확장합니다. 또한, 인터뷰 연습 서비스의 질문 생성 로직을 개선하여 관리자 설정에 따라 기술 질문 재사용 여부를 결정할 수 있도록 유연성을 더했습니다. 이는 관리자가 사용자 경험과 콘텐츠를 더욱 세밀하게 제어할 수 있게 하여, 전반적인 시스템 운영 효율성을 높이는 데 기여합니다. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| class SiteSettingsService( | ||
| private val adminInterviewSettingRepository: AdminInterviewSettingRepository | ||
| ) { |
There was a problem hiding this comment.
SiteSettingsService에서 AdminInterviewSettingRepository를 재사용하고 있습니다. AdminInterviewSetting 엔티티와 리포지토리는 interview 도메인에 속해있고 이름 또한 인터뷰 설정에 특화되어 있습니다. 사이트 전반의 설정을 저장하기 위해 이들을 사용하는 것은 도메인 경계를 모호하게 만들고 유지보수성을 떨어뜨릴 수 있습니다.
사이트 설정을 위한 별도의 SiteSetting 엔티티와 SiteSettingRepository를 site 도메인 내에 새로 생성하여 사용하는 것을 강력히 권장합니다. 이는 각 도메인의 책임과 역할을 명확하게 분리하여 코드의 구조를 개선하는 데 도움이 됩니다.
| class AdminInterviewSetting( | ||
| @Suppress("unused") | ||
| @Id | ||
| @Column(name = "setting_key", nullable = false, length = 100) | ||
| val settingKey: String, | ||
|
|
||
| @Column(name = "setting_value", nullable = false, length = 100) | ||
| var settingValue: String, | ||
|
|
||
| @Column(name = "updated_at", nullable = false) | ||
| var updatedAt: OffsetDateTime = OffsetDateTime.now() | ||
| ) { | ||
| @PrePersist | ||
| fun prePersist() { | ||
| updatedAt = OffsetDateTime.now() | ||
| } | ||
|
|
||
| @PreUpdate | ||
| fun preUpdate() { | ||
| updatedAt = OffsetDateTime.now() | ||
| } | ||
| } |
There was a problem hiding this comment.
updatedAt 필드가 생성자에서 OffsetDateTime.now()로 초기화되고, @PrePersist 라이프사이클 콜백에서도 다시 OffsetDateTime.now()로 설정되고 있습니다. 이는 중복된 로직입니다. 필드를 주 생성자 밖으로 이동시키고 lateinit으로 선언하여 초기화 로직을 @PrePersist에서만 관리하도록 하면 코드가 더 명확해집니다.
class AdminInterviewSetting(
@Suppress("unused")
@Id
@Column(name = "setting_key", nullable = false, length = 100)
val settingKey: String,
@Column(name = "setting_value", nullable = false, length = 100)
var settingValue: String
) {
@Column(name = "updated_at", nullable = false)
lateinit var updatedAt: OffsetDateTime
@PrePersist
fun prePersist() {
updatedAt = OffsetDateTime.now()
}
@PreUpdate
fun preUpdate() {
updatedAt = OffsetDateTime.now()
}
}| class PatchNote( | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| val id: Long = 0, | ||
|
|
||
| @Column(name = "title", nullable = false, length = 160) | ||
| var title: String, | ||
|
|
||
| @Column(name = "body", nullable = false, columnDefinition = "text") | ||
| var body: String, | ||
|
|
||
| @Column(name = "sort_order", nullable = false) | ||
| var sortOrder: Int = 0, | ||
|
|
||
| @Column(name = "is_published", nullable = false) | ||
| var isPublished: Boolean = true, | ||
|
|
||
| @Column(name = "created_at", nullable = false) | ||
| var createdAt: OffsetDateTime = OffsetDateTime.now(), | ||
|
|
||
| @Column(name = "updated_at", nullable = false) | ||
| var updatedAt: OffsetDateTime = OffsetDateTime.now() | ||
| ) { | ||
| @PrePersist | ||
| fun prePersist() { | ||
| val now = OffsetDateTime.now() | ||
| createdAt = now | ||
| updatedAt = now | ||
| } | ||
|
|
||
| @PreUpdate | ||
| fun preUpdate() { | ||
| updatedAt = OffsetDateTime.now() | ||
| } | ||
| } |
There was a problem hiding this comment.
createdAt과 updatedAt 필드가 생성자에서 OffsetDateTime.now()로 초기화된 후, @PrePersist 콜백에서 즉시 다시 할당되고 있어 중복이 발생합니다. 이 필드들을 주 생성자 밖으로 옮기고 lateinit을 사용하여 초기화 로직을 라이프사이클 콜백에서만 관리하도록 수정하면 코드의 의도가 더 명확해집니다. 추가로, createdAt 필드는 생성된 후에 변경되어서는 안 되므로 @Column(updatable = false) 속성을 추가하는 것이 좋습니다.
class PatchNote(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,
@Column(name = "title", nullable = false, length = 160)
var title: String,
@Column(name = "body", nullable = false, columnDefinition = "text")
var body: String,
@Column(name = "sort_order", nullable = false)
var sortOrder: Int = 0,
@Column(name = "is_published", nullable = false)
var isPublished: Boolean = true
) {
@Column(name = "created_at", nullable = false, updatable = false)
lateinit var createdAt: OffsetDateTime
@Column(name = "updated_at", nullable = false)
lateinit var updatedAt: OffsetDateTime
@PrePersist
fun prePersist() {
val now = OffsetDateTime.now()
createdAt = now
updatedAt = now
}
@PreUpdate
fun preUpdate() {
updatedAt = OffsetDateTime.now()
}
}| patchNoteRepository.saveAll(allPatchNotes) | ||
| return patchNoteRepository.findAllByOrderBySortOrderAscCreatedAtDesc() | ||
| .map { it.toAdminResponse() } |
There was a problem hiding this comment.
patchNoteRepository.saveAll()을 호출한 후에 다시 patchNoteRepository.findAllByOrderBySortOrderAscCreatedAtDesc()를 호출하여 데이터베이스에서 패치노트 목록을 다시 조회하고 있습니다. saveAll() 메소드는 저장된 엔티티 목록을 반환하므로, 이 결과를 직접 사용하여 정렬하고 DTO로 변환하면 불필요한 데이터베이스 조회를 줄여 성능을 개선할 수 있습니다.
val savedPatchNotes = patchNoteRepository.saveAll(allPatchNotes)
return savedPatchNotes
.sortedWith(compareBy<PatchNote> { it.sortOrder }.thenByDescending { it.createdAt })
.map { it.toAdminResponse() }There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5df8467731
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import java.time.OffsetDateTime | ||
|
|
||
| @Entity | ||
| @Table(name = "admin_interview_settings") |
There was a problem hiding this comment.
Add DB migration for new settings and patch note tables
This commit adds entities for admin_interview_settings and patch_notes (AdminInterviewSetting and PatchNote) but does not include any schema migration/DDL in the repository, so deployments that use the default spring.jpa.hibernate.ddl-auto=${JPA_DDL_AUTO:validate} will fail at startup when those tables are not pre-created. Please add the corresponding migration in the same change set to avoid runtime schema-validation failures.
Useful? React with 👍 / 👎.
📢 기능 설명
필요시 실행결과 스크린샷 첨부
연결된 issue
연결된 issue를 자동으로 닫기 위해 아래 {이슈넘버}를 입력해주세요.
close #{67}
🩷 Approve 하기 전 확인해주세요!
✅ 체크리스트